/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Entidades;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author USUARIO
 */
@Entity
@Table(name = "cheque")
@NamedQueries({
    @NamedQuery(name = "Cheque.findAll", query = "SELECT c FROM Cheque c")})
public class Cheque implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "nro_transaccion")
    private Integer nroTransaccion;
    @Basic(optional = false)
    @Column(name = "nro_cheque")
    private long nroCheque;
    @Basic(optional = false)
    @Column(name = "emisor")
    private String emisor;
    @Basic(optional = false)
    @Column(name = "fecha_emision")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaEmision;
    @Basic(optional = false)
    @Column(name = "fecha_vec")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaVec;
    @Basic(optional = false)
    @Column(name = "plaza")
    private String plaza;
    @JoinColumn(name = "banco", referencedColumnName = "id_banco")
    @ManyToOne
    private Banco banco;
    @JoinColumn(name = "nro_transaccion", referencedColumnName = "nro_transaccion", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Pago pago;

    public Cheque() {
    }

    public Cheque(Integer nroTransaccion) {
        this.nroTransaccion = nroTransaccion;
    }

    public Cheque(Integer nroTransaccion, long nroCheque, String emisor, Date fechaEmision, Date fechaVec, String plaza) {
        this.nroTransaccion = nroTransaccion;
        this.nroCheque = nroCheque;
        this.emisor = emisor;
        this.fechaEmision = fechaEmision;
        this.fechaVec = fechaVec;
        this.plaza = plaza;
    }

    public Integer getNroTransaccion() {
        return nroTransaccion;
    }

    public void setNroTransaccion(Integer nroTransaccion) {
        this.nroTransaccion = nroTransaccion;
    }

    public long getNroCheque() {
        return nroCheque;
    }

    public void setNroCheque(long nroCheque) {
        this.nroCheque = nroCheque;
    }

    public String getEmisor() {
        return emisor;
    }

    public void setEmisor(String emisor) {
        this.emisor = emisor;
    }

    public Date getFechaEmision() {
        return fechaEmision;
    }

    public void setFechaEmision(Date fechaEmision) {
        this.fechaEmision = fechaEmision;
    }

    public Date getFechaVec() {
        return fechaVec;
    }

    public void setFechaVec(Date fechaVec) {
        this.fechaVec = fechaVec;
    }

    public String getPlaza() {
        return plaza;
    }

    public void setPlaza(String plaza) {
        this.plaza = plaza;
    }

    public Banco getBanco() {
        return banco;
    }

    public void setBanco(Banco banco) {
        this.banco = banco;
    }

    public Pago getPago() {
        return pago;
    }

    public void setPago(Pago pago) {
        this.pago = pago;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (nroTransaccion != null ? nroTransaccion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cheque)) {
            return false;
        }
        Cheque other = (Cheque) object;
        if ((this.nroTransaccion == null && other.nroTransaccion != null) || (this.nroTransaccion != null && !this.nroTransaccion.equals(other.nroTransaccion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Cheque[ nroTransaccion=" + nroTransaccion + " ]";
    }
    
}
